#pragma once

#include"hash_table.h"

namespace my_space
{
	template<class K, class V, class Hash = HashFunc<K>>
	class unordered_map
	{
		struct MapKeyOfT
		{
			const K& operator()(const std::pair<const K, V>& kv)
			{
				return kv.first;
			}
		};

		typedef typename hash_bucket::HashTable<K, std::pair<const K, V>, MapKeyOfT, Hash>::iterator iterator;
		typedef typename hash_bucket::HashTable<K, std::pair<const K, V>, MapKeyOfT, Hash>::const_iterator const_iterator;
	public:

		iterator begin()
		{
			return _ht.begin();
		}

		iterator end()
		{
			return _ht.end();
		}

		const_iterator cbegin() const
		{
			return _ht.cbegin();
		}

		const_iterator cend() const
		{
			return _ht.cend();
		}

		std::pair<iterator, bool>& insert(const std::pair<const K, V>& kv)
		{
			return _ht.Insert(kv);
		}

	private:
		hash_bucket::HashTable<K, std::pair<const K, V>, MapKeyOfT, Hash> _ht;
	};

	void test_unordered_map1()
	{
		unordered_map<int, int> m;

		m.insert(std::make_pair(1, 1));
		m.insert(std::make_pair(2, 2));
		m.insert(std::make_pair(3, 3));
	}
}